#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.deck import deck
from core.poker import poker

'''
game.FAL.FAL(pokery)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
斗地主扑克(因为地主中2有特殊用途)
'''
class FAL(poker):
    def __init__(self,pointnum,color):
        self.__pointnum__=pointnum
        self.__color__=color
        self.__value__=pointnum+color*0.01
        if pointnum <= 10:
            self.__displayname__=str(pointnum)
        elif pointnum == 11:
            self.__displayname__="J"
        elif pointnum == 12:
            self.__displayname__="Q"
        elif pointnum == 13:
            self.__displayname__="K"
        elif pointnum == 14:
            self.__displayname__="A"
        elif pointnum ==15:
            self.__displayname__="2"
        elif pointnum == 16:
            self.__displayname__="小鬼"
            self.__value__=self.__value__*2
        elif pointnum == 17:
            self.__displayname__="大鬼"
            self.__value__=self.__value__*2


'''
game.FAL.FALDeck(deck)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
地主扑克(一副)
'''
class FALDeck(deck):
    def __init__(self):
        '''
        Feature
            __init__(self)
        Description
            初始化扑克
        '''
        for num in range(3,18):
            c_num=5
            if num>15:
                c_num=2
            for color in range(1,c_num):
                item=FAL(num,color)
                self.__pokerlist__.append(item)

    def landowner(self,owner):
        '''
        Feature
            landowner(self,owner)
        Description
            拿地主
        Args
            owner:
                Type:string
                Description:玩家
        '''
        landownerPoker=[] #底牌
        pokeNum=len(self.__pokerlist__)
        for i in range(0,pokeNum):
            landownerPoker.append(self.__pokerlist__[0])
            self.__player__[owner].append(self.__pokerlist__[0])
            del self.__pokerlist__[0]   #移出底牌
        self.__player__[owner]=self.sort(self.__player__[owner]) #地主手牌重新排序
        
    def deal(self):
        '''
        Feature
            deal(self)
        Descripon
            发牌
        '''
        deck.deal(self,17,7)